package com.spring.springmvc.请求.传参;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/header")
@RestController
public class 获取header {
    @RequestMapping("/getHeader")
    public String getHeader(HttpServletRequest request){
        String userHeader = request.getHeader("Connection");
        return "用户header："+userHeader;
    }

    @RequestMapping("/getHeader1")
    public String getHeader1(@RequestHeader("Connection") String name){
        return "用户header："+name;
    }

}
